home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / go / prog / vt220 < prev    next >
Encoding:
Internet Message Format  |  1993-06-20  |  7.0 KB

  1. From: marc@praxis.co.uk (Marc Munro)
  2.  
  3. The following stuff allows go positions to be displayed on a vt220 or
  4. (good) compatible terminal.  It uses vt220 user-defined characters (soft
  5. fonts) to do this, but as many vt220 emulations do not cope with these,
  6. it may not work on your site.
  7.  
  8. In addition to the uuencoded graphics files, there is a set of C
  9. definitions for the graphic set, an empty board display, and various
  10. useful vt220 escape sequences.  Use them as you will.
  11.  
  12. There are two uuencoded files included here: defs.vt220 and eg.vt220.
  13. defs.vt220 contains only definitions of the soft font.  eg.vt220 contains
  14. the definition, and an example display.  List this file to your terminal
  15. to see how it looks and whether it works at all.
  16.  
  17. The defs.vt220 file defines a soft graphics font starting with the
  18. character 'a', with a matrix size of 8 * 10, called '**0'.
  19.  
  20. It defines the following characters:
  21.  
  22. Position        Board Char.        White Stone        Black Stone
  23.  
  24. top left corner        b        l        r
  25. top right corner    c        m        s
  26. bottom left corner    d        n        t
  27. bottom right corner    e        o        u
  28. top line        f        l        r
  29. bottom line        g        n        t
  30. left hand side        h        p        v
  31. right hand side        i        q        w
  32. middle point        j        p        v
  33. star (handicap) point    k        p        v
  34.  
  35. stone off the board            x        y
  36.  
  37.  
  38. I find that the board looks best in double-width characters in inverse
  39. video.
  40.  
  41. So, to display a board you would:
  42.  
  43. - list defs.vt220 to your terminal
  44. - clear the screen
  45. - for each line of the board
  46.     - set double width on
  47.     - send a few spaces (to center the board)
  48.     - set the screen into inverse video
  49.     - select font '**0'
  50.     - send the characters to display the board line (see below)
  51.     - revert to standard font
  52.     - reset from inverse video
  53.  
  54. If you wanted to display a full size board, with a line of alternate
  55. black and white stones running down the middle, and a few stones off the
  56. board (to indicate prisoners), you would use something like the following
  57. for the board characters:
  58.  
  59. bffffffffrffffffffc    5    2
  60. hjjjjjjjjpjjjjjjjji
  61. hjjjjjjjjvjjjjjjjji
  62. hjjkjjjjjpjjjjjkjji
  63. hjjjjjjjjvjjjjjjjji
  64. hjjjjjjjjpjjjjjjjji
  65. hjjjjjjjjvjjjjjjjji
  66. hjjjjjjjjpjjjjjjjji
  67. hjjjjjjjjvjjjjjjjji
  68. hjjkjjjjjpjjjjjkjji
  69. hjjjjjjjjvjjjjjjjji
  70. hjjjjjjjjpjjjjjjjji
  71. hjjjjjjjjvjjjjjjjji
  72. hjjjjjjjjpjjjjjjjji
  73. hjjjjjjjjvjjjjjjjji    x
  74. hjjkjjjjjpjjjjjkjji    x
  75. hjjjjjjjjvjjjjjjjji    x    
  76. hjjjjjjjjpjjjjjjjji    x    y
  77. dggggggggtgggggggge    x    y
  78.  
  79. Note that the characters '5' and '2' (representing the number of prisoners)
  80. appear as ordinary text because they are not part of the graphics font.
  81.  
  82.  
  83. /* Here are the C definitions.  */
  84.  
  85. static char *char_def [] = 
  86. {
  87.   "\033P2;65;2;5{**0",  "OOOOOOOO/????????;", "???oOOOO/???N????;",
  88.   "OOOo????/???N????;", "???^OOOO/????????;", "OOO^????/????????;",
  89.   "OOOoOOOO/???N????;", "OOO^OOOO/????????;", "???~OOOO/???N????;",
  90.   "OOO~????/???N????;", "OOO~OOOO/???N????;", "OOw~wOOO/???N????;",
  91.   "{AAAAA{O/@AAMAA@?;", "{AAAAA{?/@AAMAA@?;", "{AABAA{O/@AAAAA@?;",
  92.   "{AABAA{?/@AAAAA@?;", "{AABAA{O/@AAMAA@?;", "{AABAA{?/@AAMAA@?;",
  93.   "{}}}}}{O/@BBNBB@?;", "{}}}}}{?/@BBNBB@?;", "{}}~}}{O/@BBBBB@?;",
  94.   "{}}~}}{?/@BBBBB@?;", "{}}~}}{O/@BBNBB@?;", "{}}~}}{?/@BBNBB@?;",
  95.   "{AAAAA{?/@AAAAA@?;", "{}}}}}{?/@BBBBB@?",  "\033\\"
  96. }; /* Define the graphic character set.  */
  97.  
  98. static char *board_19 [] = 
  99. {
  100.   "bfffffffffffffffffc",  "hjjjjjjjjjjjjjjjjji",  "hjjjjjjjjjjjjjjjjji",
  101.   "hjjkjjjjjkjjjjjkjji",  "hjjjjjjjjjjjjjjjjji",  "hjjjjjjjjjjjjjjjjji",
  102.   "hjjjjjjjjjjjjjjjjji",  "hjjjjjjjjjjjjjjjjji",  "hjjjjjjjjjjjjjjjjji",
  103.   "hjjkjjjjjkjjjjjkjji",  "hjjjjjjjjjjjjjjjjji",  "hjjjjjjjjjjjjjjjjji",
  104.   "hjjjjjjjjjjjjjjjjji",  "hjjjjjjjjjjjjjjjjji",  "hjjjjjjjjjjjjjjjjji",
  105.   "hjjkjjjjjkjjjjjkjji",  "hjjjjjjjjjjjjjjjjji",  "hjjjjjjjjjjjjjjjjji",
  106.   "dggggggggggggggggge"
  107. };
  108.  
  109. /* General screen control strings.                                           */
  110.  
  111. /* Assign US-ASCII to charset G0 and soft-font '**0' to charset G1.          */
  112. static char *assign_sets   = {"\033(B\033)**0"};
  113.  
  114. static char *clear_screen  = "\033[2J";
  115. static char *double_width  = "\033#6";
  116. static char *position_curs = "\033[%d;%dH"; /* See below. */
  117. static char *save_curs     = "\0337";
  118. static char *reset_curs    = "\0338";
  119. static char *scroll_off    = "\033[21;0r";  /* Make top 21 lines */
  120.                            /* non-scrolling.    */
  121. static char *scroll_on     = "\033[?0;0r";
  122. static char *graphics_on   = "\016";          /* Select charset G1 */
  123. static char *ascii_on      = "\017";          /* Select charset G0 */
  124. static char *inverse_on    = "\033[7m";
  125. static char *inverse_off   = "\033[27m";
  126. static char *flash_on      = "\033[5;1m";
  127. static char *flash_off     = "\033[25;22m";
  128. static char *reset_term    = "\033[!p";
  129.  
  130. /* use printf (position_curs, coord_1, coord_2) to position the cursor!      */
  131.  
  132.  
  133. Finally, here are the uuencoded files.
  134.  
  135. BEGIN defs.vt220 ---- cut here ------
  136. begin 644 defs.vt220
  137. M&U R.S8U.S([-7LJ*C!/3T]/3T]/3R\_/S\_/S\_/SL_/S]O3T]/3R\_/S].
  138. M/S\_/SM/3T]O/S\_/R\_/S]./S\_/SL_/S]>3T]/3R\_/S\_/S\_/SM/3T]>
  139. M/S\_/R\_/S\_/S\_/SM/3T]O3T]/3R\_/S]./S\_/SM/3T]>3T]/3R\_/S\_
  140. M/S\_/SL_/S]^3T]/3R\_/S]./S\_/SM/3T]^/S\_/R\_/S]./S\_/SM/3T]^
  141. M3T]/3R\_/S]./S\_/SM/3W=^=T]/3R\_/S]./S\_/SM[04%!04%[3R] 04%-
  142. M04% /SM[04%!04%[/R] 04%-04% /SM[04%"04%[3R] 04%!04% /SM[04%"
  143. M04%[/R] 04%!04% /SM[04%"04%[3R] 04%-04% /SM[04%"04%[/R] 04%-
  144. M04% /SM[?7U]?7U[3R] 0D).0D) /SM[?7U]?7U[/R] 0D).0D) /SM[?7U^
  145. M?7U[3R] 0D)"0D) /SM[?7U^?7U[/R] 0D)"0D) /SM[?7U^?7U[3R] 0D).
  146. <0D) /SM[?7U^?7U[/R] 0D).0D) /QM<  H*"D) 
  147.  
  148. end
  149. END ----- cut here ------
  150.  
  151. BEGIN eg.vt220 ---- cut here ------
  152. begin 644 eg.vt220
  153. M&U R.S8U.S([-7LJ*C!/3T]/3T]/3R\_/S\_/S\_/SL_/S]O3T]/3R\_/S].
  154. M/S\_/SM/3T]O/S\_/R\_/S]./S\_/SL_/S]>3T]/3R\_/S\_/S\_/SM/3T]>
  155. M/S\_/R\_/S\_/S\_/SM/3T]O3T]/3R\_/S]./S\_/SM/3T]>3T]/3R\_/S\_
  156. M/S\_/SL_/S]^3T]/3R\_/S]./S\_/SM/3T]^/S\_/R\_/S]./S\_/SM/3T]^
  157. M3T]/3R\_/S]./S\_/SM/3W=^=T]/3R\_/S]./S\_/SM[04%!04%[3R] 04%-
  158. M04% /SM[04%!04%[/R] 04%-04% /SM[04%"04%[3R] 04%!04% /SM[04%"
  159. M04%[/R] 04%!04% /SM[04%"04%[3R] 04%-04% /SM[04%"04%[/R] 04%-
  160. M04% /SM[?7U]?7U[3R] 0D).0D) /SM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